package com.nuedu.corejava.ch13.homework;
/**
 * 

4、编写一个计时器，每隔一秒钟，在控制台打印出最新时间。 [必做题] 
 * 
 * 
 */
import java.text.SimpleDateFormat;
import java.util.Date;


public class Clerck extends Thread{
	private String nowData = null;

	@Override
	public void run() {
		while (true) {
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			SimpleDateFormat sFormat = new SimpleDateFormat("YYYY-MM-dd  HH:mm:ss:SS");
			nowData = sFormat.format(new Date());
			System.out.println(nowData);
		}
		
	}
	public static void main(String[] args) {
		Clerck clock = new Clerck();
		clock.start();
	}

}
